// TODO set tpl cache.
// TODO more path setup and error process.
dojo.provide("lotex.system.AsynControler");

dojo.require("dojo.lang.declare");
dojo.require("dojo.event.*");
dojo.require("lotex.array");


dojo.declare("lotex.system.AsynControler", null,
    function(s) {
        this.signal = s || 0;
        this.keys = [];
    },
{
    add: function(/*int*/ signal) {
        this.signal += signal || 1;
    },

    remove: function(key) {
        if(key && dojo.lang.has(this.keys, key)) return;

        this.keys.push(key);
        this.signal--;
        if(this.signal<=0) this.complete();
    },

    complete: function() {}
});